﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using Conqueror.WP.ViewModel;

namespace Conqueror.WP.View
{
    public partial class QuickAction : UserControl
    {
        public QuickAction()
        {
            InitializeComponent();
            Loaded += (o, e) =>
            {
                ((QuickActionViewModel)DataContext).Expanded += (obj, expanded) =>
                {
                    if (expanded)
                        this.openQuickAction.Begin();
                    else this.closeQuickAction.Begin();
                };

                if (((QuickActionViewModel)DataContext).IsExpanded)
                    this.openQuickAction.Begin();
                else this.closeQuickAction.Begin();
            };
        }

        private void OnTapExpandContract(object sender, System.Windows.Input.GestureEventArgs e)
        {
            var context = ((QuickActionViewModel)DataContext);
            context.IsExpanded = !context.IsExpanded;
        }
    }
}
